package com.example.demo.api;

import com.example.demo.entity.Reservation;
import com.example.demo.entity.Stadium;

import java.util.List;

public class JsonResult {
    private long code;
    private String message;
//    private String token;
//    private List<Stadium> stadiums;
//    private Data data;
    private Object data;

    public JsonResult(long code, String message) {
        this.code = code;
        this.message = message;
    }

    public JsonResult(long code, String message, Object data) {
        this.code = code;
        this.message = message;
//        if(data instanceof String){
//
//        }
        this.data = data;
    }
//    public JsonResult(long code, String message, String token) {
//        Data data=new Data();
//        data.setToken(token);
//        this.code = code;
//        this.message = message;
//        this.data = data;
//    }
//
//    public JsonResult(long code, String message, List<Stadium> stadiums) {
//        Data data=new Data();
//        data.setStadiums(stadiums);
//        this.code = code;
//        this.message = message;
//        this.data = data;
//    }
//
//    public JsonResult(long code, String message, List<Reservation> reservations, int state) {
//        Data data=new Data();
//        data.setReservations(reservations);
//        this.code = code;
//        this.message = message;
//        this.data = data;
//    }
    public static JsonResult result(long code, String message) {

        return new JsonResult(code, message);
    }
    public static JsonResult result(long code, String message, Object data) {

    return new JsonResult(code, message, data);
    }

//    public static JsonResult result(long code, String message, String token) {
//
//        return new JsonResult(code, message, token);
//    }
//
//    public static JsonResult result(long code, String message, List<Stadium> stadiums) {
//
//        return new JsonResult(code, message, stadiums);
//    }
//
//    public static JsonResult result(long code, String message, List<Reservation> reservations, int state) {
//
//        return new JsonResult(code, message, reservations, state);
//    }


    public long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public void setCode(long code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
    //    public String getToken() {
//        return token;
//    }
//
//    public void setToken(String token) {
//        this.token = token;
//    }
//
//    public List<Stadium> getStadiums() {
//        return stadiums;
//    }
//
//    public void setStadiums(List<Stadium> stadiums) {
//        this.stadiums = stadiums;
//    }

    @Override
    public String toString() {
        return "JsonResult{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
